package com.muse.constant;

import lombok.Getter;

/**
 * Created with IntelliJ IDEA.
 * User: lee
 * Date: 2021/4/25
 * Time: 8:34 下午
 * Description:
 */
public enum Role {

    UNKNOWN("未知", -1),
    BROW_TATTOOER("纹眉师", 1),
    LECTURER("讲师", 2),
    OFFICIAL("官方账号", 3);

    @Getter
    private String name;

    @Getter
    private int value;

    Role(String name, Integer value) {
        this.name = name;
        this.value = value;
    }

    public static Role getRoleByValue(int value) {
        for (Role type : Role.values()) {
            if (type.getValue() == value) {
                return type;
            }
        }
        return UNKNOWN;
    }

    public static Role getRoleyName(String name) {
        for (Role type : Role.values()) {
            if (type.getName().equals(name)) {
                return type;
            }
        }
        return UNKNOWN;
    }

}
